package Map;

import java.util.*;

@SuppressWarnings("all")
public class For {
    public static void main(String[] args){
        HashMap<String, String> map = new HashMap<>();
        map.put("1","1");
        map.put("2","1");
        map.put("3","1");
        map.put("4","1");
        map.put("5","1");
        System.out.println("key");
        Set<String> strings = map.keySet();
        for (String string : strings) {
            System.out.println(string+":"+map.get(string));
        }

        System.out.println("======");
        Iterator<String> iterator = strings.iterator();
        while (iterator.hasNext()) {
            String next =  iterator.next();
            System.out.println(next+":"+map.get(next));
        }

        System.out.println("======");
        System.out.println("values");
        Collection<String> values = map.values();
        for (String value : values) {
            System.out.println(value);
        }
        System.out.println("");
        map.forEach((k,v)-> System.out.println(k+":"+v));

        Iterator<String> iterator1 = values.iterator();
        while (iterator1.hasNext()) {
            String next =  iterator1.next();
            System.out.println(next
            );
        }

        Set<Map.Entry<String, String>> entries = map.entrySet();
        for (Map.Entry<String, String> entry : entries) {
            Map.Entry<String, String> entry1 = entry;
            System.out.println(entry1);
        }

        System.out.println("新");
        entries.forEach(System.out::println);
        Iterator<Map.Entry<String, String>> iterator2 = entries.iterator();
        while (iterator2.hasNext()) {
            Map.Entry<String, String> next =  iterator2.next();
            System.out.println(next);
        }



    }
}
